module HplAssets.Hephaestus.MetaData where

import FeatureModel.Types
import HplAssets.Hephaestus.Types
import HplAssets.Hephaestus.MetaDataTypes
import Data.Map

--
-- An undefined feature model.
-- We do not need an actual feature model for composition.
-- (We only need configuration knowledge and feature configuration.)
--
noFeatureModel :: FeatureModel
noFeatureModel = undefined


--
-- Configuration knowledge for the Hephaestus PL.
--
configurationKnowledge :: [(FeatureExpression, [HephaestusTransformation])]
configurationKnowledge
 = [ (
       ConstantExpression True,
       [SelectEmptyProduct]
     ),
     (
       FeatureRef "Use Cases",
       [SelectAsset "Use Cases"]
     ),
     (
       And (FeatureRef "Use Cases") (FeatureRef "UcmToXML"),
       [SelectExport "UcmToXML"]
     ),
     (
       And (FeatureRef "Use Cases") (FeatureRef "UcmToLatex"),
       [SelectExport "UcmToLatex"]
     ),       
     (
       FeatureRef "Business Processes",
       [SelectAsset "Business Processes"]
     ),
     (
       And (FeatureRef "Business Processes") (FeatureRef "BpmToXML"),
       [SelectExport "BpmToXML"]
     ),       
     (
       FeatureRef "Hephaestus",
       [
         --BindProductName "Hephaestus",
         BindProductNameM1 "Hephaestus",
         BindProductNameM2 "HephaestusTypes",
         SelectAsset "Hephaestus"
       ]
     ),
     (
       And (FeatureRef "Hephaestus") (FeatureRef "HephToXML"),
       [SelectExport "HephToXML"]
     )            
   ]


--
-- Metadata about this assets used during composition.
--
assetMetaData = fromList
 [
  ( "Use Cases",
    AssetMetaData {
       assetModuleType = "UCM.Types",
       assetModuleParser = "UCM.Parsers.XML.XmlUseCaseParser",
       assetModuleType' = "TestTypes",
       assetModule = "UseCases",
       assetModel = "UseCaseModel",
       assetSelector = "ucm",
       assetSelector' = "splUcm",
       assetEmpty = "emptyUcm",
       assetXType = "UseCaseTransformation",
       assetXFun = "transformUcm",
       assetXFun' = "parseUseCaseFile",
       assetVarProperty = "u",
       assetNameProperty = "usecase-model",
       assetVarParse = "ucpl",
       assetVarSchema = "ucSchema",
       assetLstTransf = [("evaluateAspects", "EvaluateAspects", "ids", "ids", "Success"),
                         ("bindParameter", "BindParameter", "_", " ", "Fail"),
			 ("bindParameter", "BindParameter", "[x,y]", "x y", "Success"),
			 ("selectUseCases", "SelectUseCases", "ids", "ids", "Success"),
			 ("selectScenarios", "SelectScenarios", "ids", "ids", "Success") ] 
-- Attention: the assetLstTransf list must be populated in the reverse order that the pattern matching should appear. For example:
-- "bindParameter _ " must be before than "bindParameter [x,y]".
    }
  ),
  ( "Business Processes",
    AssetMetaData {
       assetModuleType = "BPM.Types",
       assetModuleParser = "BPM.Parsers.XML.XmlBusinessProcess",
       assetModuleType' = "TestTypes",
       assetModule = "BusinessProcesses",
       assetModel = "BusinessProcessModel",
       assetSelector = "bpm",
       assetSelector' = "splBpm",
       assetEmpty = "emptyBpm",
       assetXType = "BusinessProcessTransformation",
       assetXFun = "transformBpm",
       assetXFun' = "parseBusinessProcess",
       assetVarProperty = "b",
       assetNameProperty = "businessprocess-model",
       assetVarParse = "bppl",
       assetVarSchema = "bpSchema",
       assetLstTransf = [("bindParameterBpm", "BindParameterBpm", "_", " ", "Fail"),
			 ("bindParameterBpm", "BindParameterBpm", "[np,vp]", "np (Value vp)", "Success"),
			 ("evaluateAdvice", "EvaluateAdvice", "[id]", "id", "Success"),
			 ("selectBusinessProcess", "SelectBusinessProcess", "[id]", "id", "Success") ]  
    }
  ),
  ( "Hephaestus",
    AssetMetaData {
       assetModuleType = "Hephaestus.Types",
       assetModuleParser = " ",
       assetModuleType' = "HephaestusTypes",
       assetModule = "Hephaestus",
       assetModel = "HephaestusModel",
       assetSelector = "hpl",
       assetSelector' = "splHpl",
       assetEmpty = "emptyHpl",
       assetXType = "HephaestusTransformation",
       assetXFun = "transformHpl",
       assetXFun' = "parseHephaestus",
       assetVarProperty = "h",
       assetNameProperty = "hephaestus-model",
       assetVarParse = "hepl",
       assetVarSchema = "heSchema",
       assetLstTransf = []
    }
  )
 ]

--
-- Metadata about this asset's exportation used during composition.
--
exportMetaData = fromList
 [
  ( "UcmToXML",
    ExportMetaData {
       exportModule = "UCM.PrettyPrinter.XML",
       exportXType = "ExportUcmXML",
       exportXFun = "exportUcmToXML",
       exportXExt = ".xml",
       exportSelector = "ucm"
    }
  ),
  ( "UcmToLatex",
    ExportMetaData {
       exportModule = "UCM.PrettyPrinter.Latex",
       exportXType = "ExportUcmLatex",
       exportXFun = "exportUcmToLatex",
       exportXExt = ".tex",
       exportSelector = "ucm"
    }
  ),
  ( "BpmToXML",
    ExportMetaData {
       exportModule = "BPM.PrettyPrinter.XML",
       exportXType = "ExportBpmXML",
       exportXFun = "exportBpmToXML",
       exportXExt = ".xml",
       exportSelector = "bpm"
    }
  ),
  ( "HephToXML",
    ExportMetaData {
       exportModule = " ",
       exportXType = " ",
       exportXFun = " ",
       exportXExt = " ",
       exportSelector = " "
    }
  )
 ]
              